const cartBox = document.querySelector('.cartBox')
const totalPriceBox = document.querySelector('.totalPrice')
const totalNum = document.querySelector('.totalNum')
const allSelect = document.querySelector('.allSelect')
const content = document.querySelector('.content')
const sss = document.querySelector('.sss')
const id = window.localStorage.getItem('id')
const token = window.localStorage.getItem('token')
getInfo()
async function getInfo() {
  const res = await pAjax({
    url: '/dt?code=3e6bff6304c547dba650d9941aa472c0&searchWord=(channelId%3D38350)+and+(psale%3D0)&pageNo=1&pageSize=32&siteId=2&aggs=&filterJsonUrl=https%3A%2F%2Fwww.haier.com%2Fcn%2Flaundry%2Ffilter_es.json&orderBy=saleFlag%3Adesc%2CproductSaleDate%3Adesc&filter=&defaultSearch=(channelId%3D38350)+and+(psale%3D0)&retFilterJson=yes&searchColumns=productShowLabel',
    dataType: 'json'
  })
  const goods_id = window.sessionStorage.getItem('id')

// 判断一下, 如果没有 goods_id , 直接跳转回列表页
// if (!goods_id) {
//   window.location.href = './list.html'
//   throw new Error('没有您查看的商品详情')
// }
    // let goods = res.page.data.find(function(item){return item.metaDataId === goods_id})
    // console.log(goods)
    cartBox.innerHTML += `
    <li>
    <div class="select">
      <input type="checkbox">
    </div>
    <div class="show">
      <img src="../images/W020210630346872812411_580.png" alt="">
    </div>
    <div class="title">
    ${cart.pname}
    </div>
    <div class="price">
    ${cart.price}
    </div>
    <div class="number">
      <button>-</button>
      <input type="text" value="1">
      <button>+</button>
    </div>
    <div class="subprice">
      ￥ 100.00
    </div>
    <div class="del">
      <button>删除</button>
    </div>
  </li>
    ` 
}